package ${entity.packageName}.logic.gview.arrange;

import com.gonsin.base.GPageRequest;
import com.gonsin.base.GPageResult;
import com.gonsin.gview.annotations.GView;
import com.gonsin.gview.annotations.actions.GAction;
import com.gonsin.gview.annotations.actions.GSession;
import com.gonsin.gview.annotations.board.GBoard;
import com.gonsin.gview.annotations.board.GButton;
import com.gonsin.gview.annotations.board.form.GSelector;
import com.gonsin.gview.annotations.board.table.*;
import com.gonsin.gview.annotations.data.GDataChanged;
import com.gonsin.gview.annotations.data.GDataSource;
import com.gonsin.gview.annotations.data.GListData;
import com.gonsin.gview.annotations.data.GTableData;
import com.gonsin.gview.annotations.enums.ButtonAction;
import com.gonsin.gview.annotations.enums.ColumnType;
import com.gonsin.venus.base.logic.session.SessionKeys;
import ${entity.packageName}.bean.${entity.entityName}Bean;
import ${entity.packageName}.interfaces.I${entity.entityName}Service;
import ${entity.packageName}.po.${entity.entityName}SearchPo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

<#include "/gview/gview"/>
@Component
public class ${entity.entityName}View {

    @Autowired private I${entity.entityName}Service ${entity.entityNameFirstLower}Service;

    /**
     * 查询${entity.entityLabel}
     */
    @GDataSource("search${entity.entityName}")
    public GPageResult<${entity.entityName}Bean> search${entity.entityName}(
            @GSession(SessionKeys.EDIFICE_KEY) String edificeKey,
            ${entity.entityName}SearchPo searchPo,
            GPageRequest request){
        return ${entity.entityNameFirstLower}Service.search${entity.entityName}(edificeKey, searchPo, request);
    }
    /**
     * 批量删除${entity.entityLabel}
     */
    @GAction("batchDelete${entity.entityName}")
    @GDataChanged("search${entity.entityName}")
    public void batchDelete${entity.entityName}(
            @GSession(SessionKeys.EDIFICE_KEY) String edificeKey,
            ${entity.entityName}SearchPo searchPo){
        ${entity.entityNameFirstLower}Service.batchDelete${entity.entityName}(edificeKey, searchPo);
    }


    /**
     * 批量删除${entity.entityLabel}
     */
    @GAction("delete${entity.entityName}")
    @GDataChanged("search${entity.entityName}")
    public void delete${entity.entityName}(
            String arrangeKey){
        ${entity.entityNameFirstLower}Service.delete${entity.entityName}(arrangeKey);
    }
}
